From: Christian Hergert Date: Tue, 15 Mar 2022 22:52:44 +0000 (-0700) Subject: gsk/gl: make max-frame-age configurable X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~4^2~301^2~9 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=9dbd137ec8f0aab41b6cd1f55fe8d4d8f68712d8;p=gtk4.git gsk/gl: make max-frame-age configurable This is nice for some texture libraries that we might want to keep around for longer than say 60 frames such as a glyph cache. --- diff --git a/gsk/gl/gskgltexturelibrary.c b/gsk/gl/gskgltexturelibrary.c index 3d32c95945..414190ea7d 100644 --- a/gsk/gl/gskgltexturelibrary.c +++ b/gsk/gl/gskgltexturelibrary.c @@ -27,7 +27,7 @@ #include "gskgldriverprivate.h" #include "gskgltexturelibraryprivate.h" -#define MAX_FRAME_AGE 60 +#define DEFAULT_MAX_FRAME_AGE 60 G_DEFINE_ABSTRACT_TYPE (GskGLTextureLibrary, gsk_gl_texture_library, G_TYPE_OBJECT) @@ -118,6 +118,7 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass) static void gsk_gl_texture_library_init (GskGLTextureLibrary *self) { + self->max_frame_age = DEFAULT_MAX_FRAME_AGE; } void @@ -176,7 +177,7 @@ gsk_gl_texture_library_begin_frame (GskGLTextureLibrary *self, G_OBJECT_TYPE_NAME (self), dropped)); } - if (frame_id % MAX_FRAME_AGE == 0) + if (frame_id % self->max_frame_age == 0) { GskGLTextureAtlasEntry *entry; int atlased = 0; diff --git a/gsk/gl/gskgltexturelibraryprivate.h b/gsk/gl/gskgltexturelibraryprivate.h index a784449889..bb1db12172 100644 --- a/gsk/gl/gskgltexturelibraryprivate.h +++ b/gsk/gl/gskgltexturelibraryprivate.h @@ -89,10 +89,11 @@ typedef struct _GskGLTextureAtlasEntry typedef struct _GskGLTextureLibrary { - GObject parent_instance; + GObject parent_instance; GskGLDriver *driver; - GHashTable *hash_table; - guint max_entry_size; + GHashTable *hash_table; + guint max_entry_size; + guint max_frame_age; } GskGLTextureLibrary; typedef struct _GskGLTextureLibraryClass